package com.pug.service.config.mq;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * Author: lqm
 * create: 2022/4/5 16:55
 * Lover: lqx
 *
 * @see
 */
@Configuration
//用户信息保存mq配置
public class MessageDirectConfig {
    public static final String message_direct_queue="message_direct_queue";
    public static final String message_direct_exchange="message_direct_exchange";
    public static final String message_direct_key="message_direct_key";
    //普通交换机
    @Bean
    public Exchange MessageDirectExchange(){
        return new DirectExchange(message_direct_exchange,true,false); //最后还可以带参数
    }
    //普通队列
    @Bean
    public Queue MessageDirectQueue(){
        return new Queue(message_direct_queue,true,false, false);
    }
    //死信队列
    //绑定
    @Bean
    public Binding MessageDirectBinding(){
        return BindingBuilder.bind(MessageDirectQueue()).to(MessageDirectExchange()).with(message_direct_key).noargs();
    }
}
